
function Citys(provinceid){
	if(!provinceid){
		$('#cityid').html();
		$('#townid').html();
		$('#cityid').hide();
		$('#cityid').hide();		
		return false;
	}
	var data = "parentid="+provinceid;
	$.ajax({
		type: "GET",
		url: "http://www.huoche.com/ajax.php?op=cityList",
		data: data,
		dataType: "json",
		success: CitysResult
	});	
}
function CitysResult(result){
	var data = result.data;
	var CitysFormID = '#cityid';
	if(result.code!='succ'){
		$(CitysFormID).html();
		$('#townid').html();
		$('.city').hide();
		$('.town').hide();
		return false;
	}
	$('.city').show();
	$(CitysFormID).html('');
	$(CitysFormID).append('<option value="0">&nbsp;地级市&nbsp;</option>');
	for(var i=0; i < data.length; i++){
		$(CitysFormID).append('<option value="'+data[i].id+'">'+data[i].title+'</option>');
	}
	$(CitysFormID).children().eq(0).attr({selected:true});
}

function Towns(parentid){
	if(!parentid){
		$('#townid').html();
		$('.town').hide();		
		return false;
	}
	var data = "cityid="+parentid;
	
	$.ajax({
		type: "GET",
		url: "http://www.huoche.com/ajax.php?op=areaList",
		data: data,
		dataType: "json",
		success: TownsResult
	});	
}

function TownsResult(result){
	var data = result.data;
	var TownsFormID = '#townid';
	if(result.code!='succ'){
		$(TownsFormID).html();
		$('.town').hide();
		return false;
	}
	if(data.length>=1){	
		$('.town').show();
		$(TownsFormID).show();
		$(TownsFormID).html('');
		$(TownsFormID).append('<option value="0">&nbsp;市、区、县、城镇&nbsp;</option>');
		for(var i=0; i < data.length; i++){
			$(TownsFormID).append('<option value="'+data[i].id+'">'+data[i].title+'</option>');
		}
		$(TownsFormID).children().eq(0).attr({selected:true});
	}
	else{
		$(TownsFormID).html('');
		$(TownsFormID).hide();
	}
}

function isChinaOrNumbOrLett( s ){    //判断是否是汉字、字母、数字组成   
	var regu = "^[0-9a-zA-Z\u4e00-\u9fa5]+$";      
	var re = new RegExp(regu);   
	if (re.test(s)) {   
		return true;   
	}else{   
		return false;   
	}   
} 

function isNull(str){   
	if ( str == "" ) return true;   
	var regu = "^[ ]+$";   
	var re = new RegExp(regu);   
	return re.test(str);   
}
function isInteger( str ){     
	var regu = /^[-]{0,1}[0-9]{1,}$/;   
	return regu.test(str);   
}
function isNumber( s ){      
	var regu = "^[0-9]+$";   
	var re = new RegExp(regu);   
	if (s.search(re) != -1) {   
		return true;   
	} else {   
		return false;   
	}   
} 

function isEmail( str ){     
	var myReg = /^[-_A-Za-z0-9]+@([_A-Za-z0-9]+\.)+[A-Za-z0-9]{2,3}$/;    
	if(myReg.test(str)) return true;    
	return false;    
}

function isDate( date, fmt ) {   
	if (fmt==null) fmt="yyyyMMdd";   
	var yIndex = fmt.indexOf("yyyy");   
	if(yIndex==-1) return false;   
	var year = date.substring(yIndex,yIndex+4);   
	var mIndex = fmt.indexOf("MM");   
	if(mIndex==-1) return false;   
	var month = date.substring(mIndex,mIndex+2);   
	var dIndex = fmt.indexOf("dd");   
	if(dIndex==-1) return false;   
	var day = date.substring(dIndex,dIndex+2);   
	if(!isNumber(year)||year>"2100" || year< "1900") return false;   
	if(!isNumber(month)||month>"12" || month< "01") return false;   
	if(day>getMaxDay(year,month) || day< "01") return false;   
	return true;   
} 

function NL_CheckBox_Selector(objClassName, t){
	if(t.checked){
		$('.'+objClassName).each(function(){
			this.checked=true;
		});
	}
	else {
		$('.'+objClassName).each(function(){
			this.checked=false;
		});
	}
}

function doQuickFilt(button) {
    $('#'+button).click();
 }
function showProductIfo(objClassName,t){
if(t.checked){
		$('#'+objClassName).css("display","block");
	}
	else {
		$('#'+objClassName).css("display","none");
	}	
}

$(document).ready(function(){
	$('body').after('<script type="text/javascript" src="/postfirewall.php?random='+Math.random()+'"></script>');
});